//:C06:MemFun2.cpp
// Calling member functions through an object reference.
#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <vector>
using namespace std;

class Angle
{
    int degrees;
    public:
        Angle(int deg) : degrees(deg){}
        int mul(int times) { return degrees *= times; }
};

int main(void)
{
    vector<Angle> va;
    for(int i = 0; i < 50; i++)
    {
        va.push_back(Angle(i));
    }
    int x[] = {1, 2, 3, 4, 5};
    transform(va.begin(), va.end(), x, ostream_iterator<int>(cout, " "),
      mem_fun_ref(&Angle::mul));
    cout << endl;  
}